<template>
    <form :action="currentType.action" method="get">
        <select class="form-control-sm form-select" v-model="currentTypeIndex">
            <option v-for="(type,index) in types" :value="index">{{type.name}}</option>
        </select>
        <input class="form-input border-60 form-control-sm" type="text" name="keyword">
        <button class="btn btn-default btn-outline rounded-lg">搜索</button>
    </form>
</template>

<script>
    export default {
        name: "TigGlobalSearch", data: function () {
            return {
                types: [{name: '作品', action: '/search/repositories'}, {
                    name: '章节',
                    action: '/search/chapters'
                }, {name: '用户', action: '/search/users'}],
                currentTypeIndex: 0
            }
        }, computed: {
            currentType: function () {
                return this.types[this.currentTypeIndex];
            }
        }, methods: {}
    }
</script>

<style scoped>

</style>